<template>
  <div>
    <Breadcrumb>
      <BreadcrumbItem>弹窗配置</BreadcrumbItem>
      <BreadcrumbItem>弹窗列表</BreadcrumbItem>
    </Breadcrumb>
    <Form ref="formInline" :model="request" inline>
      <FormItem>
        弹窗名: <Select clearable  style="width: 120px;">
        <Option value="0">001弹窗</Option>
        <Option value="1">>002弹窗</Option>
      </Select>
      </FormItem>
      <FormItem>
        弹窗类型: <Select clearable  style="width: 120px;">
        <Option value="0">复古型号</Option>
        <Option value="1">艳丽型号</Option>
      </Select>
      </FormItem>
      <FormItem>
        <Button type="primary" @click="$router.push('/windowConfig/new')" style="margin-right: 10px">添加</Button>
      </FormItem>
    </Form>
    <div>
      <Table :columns="columns1" :data="data">
        <template slot-scope="{ row }" slot="option">
          <Button
            type="primary"
            size="small"
            style="margin-right: 5px"
            @click="goDel(row.order_id, row.id)"
            v-hasPermission="['39']">删除</Button>
          <Button
            type="error"
            size="small"
            style="margin-right: 5px"
            @click="goDel(row.order_id, row.id)"
            v-hasPermission="['39']">禁用</Button>
        </template>
      </Table>
    </div>
    <!--    分页功能-->
    <div style="display: flex; justify-content: center;">
      <Page style="display: flex;justify-content: center;margin-top: 24px;" :total="page.count" :page-size="20" :page-size-opts="[20,30,40,50,100]" show-elevator show-sizer show-total
            @on-change="handleCurrentChange" @on-page-size-change="handleSizeChange" />
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        formItem: {
          checkbox: []
        },
        params: {
          device_time: [],
          status: 1,
          user_id: "",
          order_id: "",
          activity_id: "",
          page: 1,
          limit: 10,
        },
        total: 0,
        page: {},
        height: this.$store.state.height,
        data1: [
          {
            id: 1,
            title: "机器组3",
          },
          {
            id: 2,
            title: "机器组4",
          },
        ],
        request: {
          device_number: "",
          page: 1,
        },
        columns1: [
          {
            title: "弹窗名",
            key: "window_name",
            minWidth: 150,
            align: "center"
          },
          {
            title: "弹窗类型",
            key: "window_types",
            minWidth: 150,
            align: "center"
          },
          {
            title: "状态",
            key: "status",
            minWidth: 150,
            align: "center"
          },
          {
            title: "操作",
            slot: "option",
            width: 200,
            align: "center",
            fixed: "right"
          }
        ],
        data: [
          {
            window_name: '001弹窗',
            window_types:'001',
            window_status:'借阅中'

          },
          {
            window_name: '002弹窗',
            window_types:'002',
            window_status:'借阅结束'
          }
        ],
        role_id:null,
      };
    },
    mounted() {

      this.init();
    },
    methods: {
      init() {
        this.axios.post("order/order_list", this.params).then((res) => {
          console.log("this.params: ", this.params);
          if (res.code == 1) {
            console.log(res);
            this.total = res.data.count;
            this.tableData = res.data.list;
          }
        });
      },
      search() {
        this.params.page = 1;
        this.init();
      },
      confirm() {
        this.modal1 = false;
        this.$Message.success("保存成功！");
        this.cancel();
      },
      cancel() {},
      add() {
        this.modal1 = true;
      },
      setStatus(id, status) {
        var text = "确定要" + (status == 1 ? "启用" : "禁用") + "此机器组么？";
        this.$Modal.confirm({
          title: text,
          onOk: () => {
            this.$Message.success("操作成功");
          },
          onCancel: () => {},
        });
      },
      lists() {},
      timechange(val) {
        console.log(val);
      },
      handleSizeChange(val) {
        this.request.page = 1;
        this.request.limit = val;
        this.lists();
      },
      handleCurrentChange(val) {
        this.params.page = val;
        this.init();
      },
    },
  };
</script>

<style>
  *{
    margin: 0;
    padding: 0;
  }
  .door_device{
    position: relative;
    top: -20px;
  }
  .vertical{
    font-size: 16px;

  }
</style>
